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

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: E = None
        self.o: E = 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.w: D = None
        self.z: E = None
        self.r: C = None
        self.txt = txt

d = A("d")
a = B("a")
j = C("j")
b = D("b")
l = E("l")
h = F("h")

d.o = h
d.x = h
a.u = j
j.w = l
j.v = l
j.u = l
j.o = b
j.z = b
j.q = d
b.q = l
b.t = l
b.o = l
l.q = a
h.w = b
h.z = l
h.r = j
assert j.o.q.q.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.x: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: E = None
        self.o: E = 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.w: D = None
        self.z: E = None
        self.r: C = None
        self.txt = txt

d = A("d")
a = B("a")
j = C("j")
b = D("b")
l = E("l")
h = F("h")

d.o = h
d.x = h
a.u = j
j.w = l
j.v = l
j.u = l
j.o = b
j.z = b
j.q = d
b.q = l
b.t = l
b.o = l
l.q = a
h.w = b
h.z = l
h.r = j
assert j.o.q.q.u.q.txt == "d"