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

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: D = None
        self.s: F = None
        self.x: D = None
        self.r: E = None
        self.p: E = None
        self.txt = txt

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

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

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

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

k.x = m
k.r = j
k.p = i
g.u = m
i.u = g
i.y = f
i.x = f
i.s = m
i.r = j
i.p = j
f.x = g
j.p = g
j.q = k
j.z = m
m.o = i
m.q = g
m.r = k
m.p = b
b.u = m
assert i.x.x.u.p.u.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.r: E = None
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: D = None
        self.s: F = None
        self.x: D = None
        self.r: E = None
        self.p: E = None
        self.txt = txt

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

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

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

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

k.x = m
k.r = j
k.p = i
g.u = m
i.u = g
i.y = f
i.x = f
i.s = m
i.r = j
i.p = j
f.x = g
j.p = g
j.q = k
j.z = m
m.o = i
m.q = g
m.r = k
m.p = b
b.u = m
assert i.x.x.u.p.u.r.r.txt == "j"