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

class B:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: D = None
        self.z: A = None
        self.t: E = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: D = None
        self.z: A = None
        self.t: E = None
        self.txt = txt

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

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

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

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

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

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