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

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

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

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

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

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

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

j.x = f
j.t = g
j.q = c
l.x = b
b.o = j
b.r = c
b.v = l
c.r = b
c.q = g
g.s = l
f.o = b
h.o = b
assert l.x.r.q.s.x.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.t: E = None
        self.q: D = None
        self.txt = txt

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

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

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

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

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

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

j.x = f
j.t = g
j.q = c
l.x = b
b.o = j
b.r = c
b.v = l
c.r = b
c.q = g
g.s = l
f.o = b
h.o = b
assert l.x.r.q.s.x.o.x.txt == "f"