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

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

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

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

f = A("f")
i = B("i")
b = C("b")
a = D("a")
c = B("c")
g = C("g")
h = A("h")
d = D("d")
e = D("e")
l = D("l")

f.p = g
i.q = g
b.v = g
a.w = h
a.x = i
a.t = f
c.q = b
g.v = b
h.p = b
d.w = f
d.t = f
d.x = i
e.w = h
e.x = i
e.t = f
l.w = h
l.x = c
l.t = f
assert d.t.p.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

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

f = A("f")
i = B("i")
b = C("b")
a = D("a")
c = B("c")
g = C("g")
h = A("h")
d = D("d")
e = D("e")
l = D("l")

f.p = g
i.q = g
b.v = g
a.w = h
a.x = i
a.t = f
c.q = b
g.v = b
h.p = b
d.w = f
d.t = f
d.x = i
e.w = h
e.x = i
e.t = f
l.w = h
l.x = c
l.t = f
assert d.t.p.v.v.txt == "g"