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

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: D = None
        self.w: F = None
        self.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: B = None
        self.r: F = None
        self.u: A = None
        self.p: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: F = None
        self.w: B = None
        self.txt = txt

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

c = A("c")
g = B("g")
f = C("f")
n = D("n")
m = E("m")
i = F("i")

c.v = g
c.y = g
c.p = i
c.w = m
c.x = m
c.s = n
g.x = c
g.r = n
g.q = i
f.r = g
f.p = n
f.w = i
f.q = c
n.z = g
n.s = g
n.r = i
n.p = i
n.u = c
m.t = i
m.w = g
i.o = f
assert i.o.p.u.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: F = None
        self.y: B = None
        self.w: E = None
        self.x: E = None
        self.s: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: D = None
        self.w: F = None
        self.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: B = None
        self.r: F = None
        self.u: A = None
        self.p: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: F = None
        self.w: B = None
        self.txt = txt

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

c = A("c")
g = B("g")
f = C("f")
n = D("n")
m = E("m")
i = F("i")

c.v = g
c.y = g
c.p = i
c.w = m
c.x = m
c.s = n
g.x = c
g.r = n
g.q = i
f.r = g
f.p = n
f.w = i
f.q = c
n.z = g
n.s = g
n.r = i
n.p = i
n.u = c
m.t = i
m.w = g
i.o = f
assert i.o.p.u.p.o.txt == "f"