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

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: A = None
        self.w: B = None
        self.s: D = None
        self.o: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.u: F = None
        self.v: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: F = None
        self.p: C = None
        self.s: E = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: A = None
        self.w: B = None
        self.s: D = None
        self.o: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.u: F = None
        self.v: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: F = None
        self.p: C = None
        self.s: E = None
        self.txt = txt

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

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