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

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: E = None
        self.u: A = None
        self.s: B = None
        self.w: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.s: A = None
        self.u: C = None
        self.o: D = None
        self.r: A = None
        self.txt = txt

g = A("g")
d = B("d")
f = C("f")
b = D("b")
j = E("j")
c = C("c")

g.r = j
g.o = d
g.t = b
g.p = f
d.p = c
f.o = g
f.p = g
f.v = g
b.o = c
b.x = j
b.u = g
b.w = g
b.s = d
j.t = f
j.u = f
j.s = g
j.r = g
j.o = b
c.o = g
c.p = g
c.v = g
assert g.r.o.u.o.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.o: B = None
        self.t: D = None
        self.p: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: E = None
        self.u: A = None
        self.s: B = None
        self.w: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.s: A = None
        self.u: C = None
        self.o: D = None
        self.r: A = None
        self.txt = txt

g = A("g")
d = B("d")
f = C("f")
b = D("b")
j = E("j")
c = C("c")

g.r = j
g.o = d
g.t = b
g.p = f
d.p = c
f.o = g
f.p = g
f.v = g
b.o = c
b.x = j
b.u = g
b.w = g
b.s = d
j.t = f
j.u = f
j.s = g
j.r = g
j.o = b
c.o = g
c.p = g
c.v = g
assert g.r.o.u.o.p.o.txt == "g"