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

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: B = None
        self.y: A = None
        self.o: D = None
        self.x: E = None
        self.txt = txt

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

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

c = A("c")
g = B("g")
f = C("f")
b = D("b")
e = E("e")
l = A("l")

c.w = f
c.x = f
c.p = l
g.p = b
f.p = b
f.o = b
f.v = g
f.y = l
f.x = e
b.p = g
b.r = e
b.y = e
e.z = f
l.w = f
l.x = f
l.p = c
assert f.p.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.p: A = None
        self.x: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: B = None
        self.y: A = None
        self.o: D = None
        self.x: E = None
        self.txt = txt

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

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

c = A("c")
g = B("g")
f = C("f")
b = D("b")
e = E("e")
l = A("l")

c.w = f
c.x = f
c.p = l
g.p = b
f.p = b
f.o = b
f.v = g
f.y = l
f.x = e
b.p = g
b.r = e
b.y = e
e.z = f
l.w = f
l.x = f
l.p = c
assert f.p.y.z.txt == "f"