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

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

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

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

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

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

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

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

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

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

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

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

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

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

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