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

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

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

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

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

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

j = A("j")
d = B("d")
h = C("h")
b = D("b")
e = E("e")
n = F("n")
c = E("c")

j.q = n
j.p = n
j.t = n
d.o = h
h.x = j
b.y = n
b.x = d
e.o = j
e.u = c
n.r = e
n.y = h
c.o = j
c.u = e
assert b.y.y.x.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.p: F = None
        self.t: F = None
        self.txt = txt

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

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

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

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

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

j = A("j")
d = B("d")
h = C("h")
b = D("b")
e = E("e")
n = F("n")
c = E("c")

j.q = n
j.p = n
j.t = n
d.o = h
h.x = j
b.y = n
b.x = d
e.o = j
e.u = c
n.r = e
n.y = h
c.o = j
c.u = e
assert b.y.y.x.q.y.txt == "h"