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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.u: C = None
        self.w: F = None
        self.o: D = None
        self.y: B = None
        self.txt = txt

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

h = A("h")
d = B("d")
c = C("c")
g = D("g")
n = E("n")
b = F("b")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.u: C = None
        self.w: F = None
        self.o: D = None
        self.y: B = None
        self.txt = txt

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

h = A("h")
d = B("d")
c = C("c")
g = D("g")
n = E("n")
b = F("b")

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