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

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

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.y: B = None
        self.s: F = None
        self.t: B = None
        self.o: B = None
        self.w: E = None
        self.txt = txt

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

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

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

g.r = c
g.v = c
g.p = b
g.x = l
c.q = b
c.v = b
c.u = g
c.o = g
b.t = l
b.o = l
b.x = h
l.z = h
l.s = h
l.y = c
l.t = c
l.o = c
l.w = i
i.q = h
i.s = g
i.p = g
h.u = b
assert c.v.t.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.v: B = None
        self.p: C = None
        self.x: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.y: B = None
        self.s: F = None
        self.t: B = None
        self.o: B = None
        self.w: E = None
        self.txt = txt

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

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

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

g.r = c
g.v = c
g.p = b
g.x = l
c.q = b
c.v = b
c.u = g
c.o = g
b.t = l
b.o = l
b.x = h
l.z = h
l.s = h
l.y = c
l.t = c
l.o = c
l.w = i
i.q = h
i.s = g
i.p = g
h.u = b
assert c.v.t.w.p.txt == "g"