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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: D = None
        self.q: D = None
        self.t: A = None
        self.p: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

g = A("g")
d = B("d")
b = C("b")
l = D("l")
f = E("f")
j = E("j")

g.x = b
g.v = l
g.q = l
d.q = g
b.s = g
b.t = g
b.v = l
b.q = l
b.p = d
l.t = d
f.v = j
f.y = d
j.v = f
j.y = d
assert j.y.q.q.t.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: D = None
        self.q: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: D = None
        self.q: D = None
        self.t: A = None
        self.p: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

g = A("g")
d = B("d")
b = C("b")
l = D("l")
f = E("f")
j = E("j")

g.x = b
g.v = l
g.q = l
d.q = g
b.s = g
b.t = g
b.v = l
b.q = l
b.p = d
l.t = d
f.v = j
f.y = d
j.v = f
j.y = d
assert j.y.q.q.t.q.x.txt == "b"