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

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

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: A = None
        self.w: F = None
        self.o: C = None
        self.t: A = None
        self.r: C = None
        self.txt = txt

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

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

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

j.u = m
j.t = g
j.s = b
g.s = j
g.u = j
g.v = b
f.o = j
c.x = f
c.o = f
c.r = f
c.p = j
c.t = j
c.w = b
m.q = g
b.o = g
assert f.o.u.q.v.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.t: B = None
        self.s: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: A = None
        self.w: F = None
        self.o: C = None
        self.t: A = None
        self.r: C = None
        self.txt = txt

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

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

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

j.u = m
j.t = g
j.s = b
g.s = j
g.u = j
g.v = b
f.o = j
c.x = f
c.o = f
c.r = f
c.p = j
c.t = j
c.w = b
m.q = g
b.o = g
assert f.o.u.q.v.o.v.txt == "b"