class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.u: E = None
        self.t: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: B = None
        self.q: D = None
        self.u: E = None
        self.p: E = None
        self.r: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.u: F = None
        self.w: D = None
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: E = None
        self.v: A = None
        self.p: D = None
        self.txt = txt

d = A("d")
m = B("m")
k = C("k")
l = D("l")
j = E("j")
g = F("g")
h = F("h")

d.p = l
d.u = j
d.t = g
m.z = d
k.s = l
k.q = l
k.v = m
k.u = j
k.p = j
k.r = d
l.w = d
j.r = m
j.u = g
j.x = g
j.w = l
g.u = k
g.y = j
g.v = d
g.p = l
h.u = k
h.y = j
h.v = d
h.p = l
assert d.p.w.u.u.y.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.u: E = None
        self.t: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: B = None
        self.q: D = None
        self.u: E = None
        self.p: E = None
        self.r: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.u: F = None
        self.w: D = None
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: E = None
        self.v: A = None
        self.p: D = None
        self.txt = txt

d = A("d")
m = B("m")
k = C("k")
l = D("l")
j = E("j")
g = F("g")
h = F("h")

d.p = l
d.u = j
d.t = g
m.z = d
k.s = l
k.q = l
k.v = m
k.u = j
k.p = j
k.r = d
l.w = d
j.r = m
j.u = g
j.x = g
j.w = l
g.u = k
g.y = j
g.v = d
g.p = l
h.u = k
h.y = j
h.v = d
h.p = l
assert d.p.w.u.u.y.w.w.txt == "d"