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

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: F = None
        self.x: C = None
        self.t: C = None
        self.v: B = None
        self.s: A = None
        self.z: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: B = None
        self.x: C = None
        self.txt = txt

j = A("j")
f = B("f")
k = C("k")
a = D("a")
b = E("b")
e = F("e")

j.o = a
j.w = a
j.u = b
f.t = k
f.u = k
k.o = f
k.r = b
a.q = e
a.x = k
a.t = k
a.v = f
a.z = f
a.s = j
b.w = a
b.t = f
b.x = f
e.p = k
e.x = k
e.r = f
assert a.t.o.t.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.w: D = None
        self.u: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: F = None
        self.x: C = None
        self.t: C = None
        self.v: B = None
        self.s: A = None
        self.z: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: B = None
        self.x: C = None
        self.txt = txt

j = A("j")
f = B("f")
k = C("k")
a = D("a")
b = E("b")
e = F("e")

j.o = a
j.w = a
j.u = b
f.t = k
f.u = k
k.o = f
k.r = b
a.q = e
a.x = k
a.t = k
a.v = f
a.z = f
a.s = j
b.w = a
b.t = f
b.x = f
e.p = k
e.x = k
e.r = f
assert a.t.o.t.r.t.txt == "f"