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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: D = None
        self.txt = txt

d = A("d")
b = B("b")
h = C("h")
j = D("j")
l = E("l")
m = F("m")
f = G("f")
i = D("i")

d.q = h
b.r = d
h.x = b
j.o = i
j.v = i
l.x = f
m.t = f
f.p = l
f.z = i
i.o = j
i.v = j
assert l.x.p.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: D = None
        self.txt = txt

d = A("d")
b = B("b")
h = C("h")
j = D("j")
l = E("l")
m = F("m")
f = G("f")
i = D("i")

d.q = h
b.r = d
h.x = b
j.o = i
j.v = i
l.x = f
m.t = f
f.p = l
f.z = i
i.o = j
i.v = j
assert l.x.p.x.p.txt == "l"