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

class B:
    def __init__(self, txt: str):
        self.u: B = None
        self.p: A = None
        self.z: E = None
        self.v: B = None
        self.q: F = None
        self.w: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: A = None
        self.p: E = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.u: B = None
        self.p: A = None
        self.z: E = None
        self.v: B = None
        self.q: F = None
        self.w: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: A = None
        self.p: E = None
        self.txt = txt

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

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

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

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