class A:
    def __init__(self, txt: str):
        self.y: 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.v: E = None
        self.r: E = None
        self.x: C = None
        self.y: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.y: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

a.y = j
g.z = a
h.v = b
h.r = b
h.x = i
h.y = i
l.z = b
l.y = g
b.q = j
b.u = g
b.p = a
b.w = a
b.v = a
b.x = l
j.z = i
m.v = b
m.r = b
m.x = h
m.y = h
i.v = b
i.r = b
i.x = h
i.y = m
d.z = i
assert b.x.y.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: 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.v: E = None
        self.r: E = None
        self.x: C = None
        self.y: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.y: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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