class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: D = None
        self.p: F = None
        self.y: F = None
        self.w: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.u: A = None
        self.o: B = None
        self.x: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: D = None
        self.o: D = None
        self.y: F = None
        self.p: F = None
        self.v: F = None
        self.txt = txt

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

d = A("d")
f = B("f")
g = C("g")
a = D("a")
k = E("k")
n = F("n")
h = D("h")

d.x = g
d.y = n
f.o = n
f.p = n
f.y = n
f.z = a
f.w = g
g.p = a
g.u = d
g.o = f
g.x = h
a.u = n
a.w = n
k.s = h
k.q = h
k.o = a
k.y = n
k.p = n
k.v = n
n.t = d
n.y = g
n.u = h
h.u = n
h.w = n
assert a.u.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: D = None
        self.p: F = None
        self.y: F = None
        self.w: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.u: A = None
        self.o: B = None
        self.x: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: D = None
        self.o: D = None
        self.y: F = None
        self.p: F = None
        self.v: F = None
        self.txt = txt

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

d = A("d")
f = B("f")
g = C("g")
a = D("a")
k = E("k")
n = F("n")
h = D("h")

d.x = g
d.y = n
f.o = n
f.p = n
f.y = n
f.z = a
f.w = g
g.p = a
g.u = d
g.o = f
g.x = h
a.u = n
a.w = n
k.s = h
k.q = h
k.o = a
k.y = n
k.p = n
k.v = n
n.t = d
n.y = g
n.u = h
h.u = n
h.w = n
assert a.u.t.y.txt == "n"