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

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

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

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

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

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

m = A("m")
b = B("b")
g = C("g")
e = D("e")
j = E("j")
k = F("k")

m.r = b
m.u = b
m.p = g
m.s = g
m.o = e
b.z = j
g.y = j
e.y = g
j.z = g
j.v = k
j.s = k
j.q = b
k.v = b
k.s = j
assert m.p.y.z.y.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: C = None
        self.o: D = None
        self.s: C = None
        self.u: B = None
        self.txt = txt

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

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

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

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

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

m = A("m")
b = B("b")
g = C("g")
e = D("e")
j = E("j")
k = F("k")

m.r = b
m.u = b
m.p = g
m.s = g
m.o = e
b.z = j
g.y = j
e.y = g
j.z = g
j.v = k
j.s = k
j.q = b
k.v = b
k.s = j
assert m.p.y.z.y.q.z.txt == "j"